# # '''
# # Created on 2020年3月2日
#   
# # @author: Administrator
# # '''
from flask import json
from orm.model import *

# User.drop_table()
# User.create_table()
# user1 = User.create(id=1,username='杨冬敏',password = '123456',isactive="是",sex= "女",birthday='2018-12-28',
#             address='无锡市惠山区惠山电子商务大厦1802',phone='13174066523',
# idcards='[]',dept_id = 1,employdate="2018-12-28", isleader='是')
# user2 = User.create(id=2,username='杨萍',password = '123456',isactive="是",sex= "女",birthday='2018-12-28',
#             address='无锡市惠山区惠山电子商务大厦1802',phone='13347906119',
# idcards='[]',dept_id = 2,employdate="2018-12-28",isleader='是')
# user3 = User.create(id=3,username='陈玲',password = '123456',isactive="是",sex= "女",birthday='2018-12-28',
#             address='无锡市惠山区惠山电子商务大厦1802',phone='18262250727',
# idcards='[]',dept_id = 2,employdate="2018-12-28",isleader='否')
# AppGroup.drop_table()
# AppGroup.create_table()
# tools = AppGroup.create(groupname="常用栏")
# desktop = AppGroup.create(groupname="桌面")
# menu = AppGroup.create(groupname="菜单栏")
# AllApp.drop_table()
# AllApp.create_table()
# tapp=AllApp.create(path="../service/user.html",
# imgsrc= "../desktop/icon/icon2.png",text="用户管理",group_id=tools.id)
# dapp=AllApp.create(path="../service/gongshangzhuce.html",
# imgsrc= "../desktop/icon/gongshang.png",text="工商注册",group_id=desktop.id)
# mapp=AllApp.create(path="../service/mycustomer.html",
# imgsrc="../desktop/icon/mycustomer.png",text="我的客户",group_id=desktop.id)
# mapp=AllApp.create(path="../service/customer.html",
# imgsrc="../desktop/icon/customer.png",text="公共客户",group_id=desktop.id)
# mapp=AllApp.create(path="../service/notify.html",
# imgsrc="../desktop/icon/notify.png",text="我的通知",group_id=tools.id)
# mapp=AllApp.create(path="../service/transform.html",
# imgsrc="../desktop/icon/order.png",text="流转单",group_id=desktop.id)
# UserApp.drop_table()
# UserApp.create_table()
# UserApp.create(user_id=user1.id,app_id=tapp.id)
# UserApp.create(user_id=user1.id,app_id=dapp.id)
# UserApp.create(user_id=user1.id,app_id=mapp.id)
# UserApp.create(user_id=user2.id,app_id=tapp.id)
# UserApp.create(user_id=user2.id,app_id=dapp.id)
# UserApp.create(user_id=user2.id,app_id=mapp.id)
# UserApp.create(user_id=user3.id,app_id=tapp.id)
# UserApp.create(user_id=user3.id,app_id=dapp.id)
# UserApp.create(user_id=user3.id,app_id=mapp.id)
# GongShang.drop_table()
# GongShang.create_table()
# gs = GongShang.create(
# companyname='["龙羲垣","苏垣企服","圣希满"]',
# businessscope="计算机软件开发、销售；网络技术的开发、转让；企业管理服务（不含投资与资产管理）；代理记账；企业营销策划；商标代理服务；知识产权代理服务；工商登记代理服务；商务咨询（不含投资咨询）。（依法须经批准的项目，经相关部门批准后方可开展经营活动）",
# registeredcapital=200,
# taxtype="小规模",
# paytype="认缴",
# comtype="有限公司",
# registeredaddress="客户提供",
# securities=[],
# leasingagreements=[],
# ishouseinvoice="有",
# chaptermoment='["公章","财务章"]',
# liaisons="陈其龙",
# phonenumber="18851578859",
# status="客户填写中",
# urgent="是",
# createtime="2020-03-30",
# hander=user2.id)
# GongShangDetail.drop_table()
# GongShangDetail.create_table()
# GongShangDetail.create(
# gongshang=gs.id,
# title="法人",
# name="陈其龙",
# idnumber="320222197890231",
# phonenumber="18851587789",
# capitalratio=70,
# idcards='[]'
# )
# GongShangDetail.create(
# gongshang=gs.id,
# title="监事",
# name="叶勇",
# idnumber="32000000000000",
# phonenumber="188000000000",
# capitalratio=15,
# idcards='[]'
# )
# GongShangDetail.create(
# gongshang=gs.id,
# title="财务",
# name="彭",
# idnumber="3201111111111111",
# phonenumber="18811111111111",
# capitalratio=15,
# idcards='[]'
# )
# #部门
# Dept.drop_table()
# Dept.create_table()
# dept = Dept.create(id=1,name='总经办',up_id=0)
# dept = Dept.create(id=2,name='市场部',up_id=1)
# dept = Dept.create(id=3,name='会计部',up_id=1)
# dept = Dept.create(id=4,name='人事部',up_id=1)
# dept = Dept.create(id=5,name='财务部',up_id=1)
# #职称
# Position.drop_table()
# Position.create_table()
# position = Position.create(id=1,name='市场总监',dept_id=2)
# position = Position.create(id=2,name='市场经理',dept_id=2)
# position = Position.create(id=3,name='市场专员',dept_id=2)
# position = Position.create(id=4,name='会计总监',dept_id=3)
# position = Position.create(id=5,name='财税经理',dept_id=3)
# position = Position.create(id=6,name='财税顾问',dept_id=3)
# position = Position.create(id=7,name='做账会计',dept_id=3)
# position = Position.create(id=8,name='会计助理',dept_id=3)
# position = Position.create(id=9,name='开票专员',dept_id=3)
# position = Position.create(id=10,name='工商顾问',dept_id=3)
# position = Position.create(id=11,name='工商助理',dept_id=3)
# position = Position.create(id=12,name='外勤会计',dept_id=3)
# position = Position.create(id=13,name='人事经理',dept_id=4)
# position = Position.create(id=14,name='人事专员',dept_id=4)
# position = Position.create(id=15,name='行政专员',dept_id=4)
# position = Position.create(id=16,name='总经理',dept_id=1)
# position = Position.create(id=17,name='总经理助理',dept_id=1)
# position = Position.create(id=18,name='执行总监',dept_id=1)
# #公共客户
# Customer.drop_table()
# Customer.create_table()
# customer = Customer.create(id=1,compname='龙羲垣（江苏）企业服务有限公司',legalperson='姚远',
#                            registeredcapital=100,businessscope='代理记账 软件开发',founddate='2020-01-20',area='无锡',
#                            address='无锡市惠山大道电子商务大厦1802',phone='18851578859',comptype='小规模',
#                            createdatetime='2020-06-05',updatetime='2020-06-10',src='工商',
#                            status='已签约',memo='')
# count = 0
# while count < 10000:
#     count = count +1
#     Customer.create(compname='测试公司名' + str(count),legalperson='姚远'+ str(count),
#                                registeredcapital=100+ count,businessscope='代理记账 软件开发'+ str(count),founddate='2020-01-20',area='无锡',
#                                address='无锡市惠山大道电子商务大厦1802'+ str(count),phone='18851578859',comptype='小规模',
#                                createdatetime='2020-06-05',updatetime='2020-06-10',src='工商',
#                                status='未分配',memo=str(count))
# #我的客户
# MyCustomer.drop_table()
# MyCustomer.create_table()
# myCustomer = MyCustomer.create(id=1,customer_id=1,saletype='A',
#                            weixin="已添加",adddatetime='2020-06-05',enddatetime='2020-06-10',
#                            tracker=user2.id,status='已签约')
# #我的客户记录
# TrackRecord.drop_table()
# TrackRecord.create_table()
# trackRecord = TrackRecord.create(mycustomer_id=1,createtime='2020-06-05',content='已签约')
# #通知
# Notify.drop_table()
# Notify.create_table()
# notify = Notify.create(notifier_id=user2.id,createdatetime='2020-06-28 10:00:00',content='客户类别：A->B',
#                        type="客户降级",status="未处理", memo="")

# #流转单
# TransForm.drop_table()
# TransForm.create_table()
# #团队
# Team.drop_table()
# Team.create_table()

# #区域
# Area.drop_table()
# Area.create_table()

#统计跟踪数
# SummaryTrack.drop_table()
# SummaryTrack.create_table()
#业务表
# Service.drop_table()
# Service.create_table()
# 供应商表
# Supplier.drop_table()
# Supplier.create_table()
# 供应商业务明细表
# SupplierDetail.drop_table()
# SupplierDetail.create_table()
# 抽奖名单
# Lottery.drop_table()
# Lottery.create_table()
#流转单明细
# TransFormDetail.create_table()
#服务项目明细
#ServiceDetail.create_table()
# Borrow.drop_table()
# Borrow.create_table()
# PayForm.drop_table()
# PayForm.create_table()

# ExpenseForm.drop_table()
# ExpenseForm.create_table()

# TransFormRecorder.drop_table()
# TransFormRecorder.create_table()

# ExpenseForm.drop_table()
# ExpenseForm.create_table()
# Document.drop_table()
# Document.create_table()

